import os
import sys
os.chdir(sys.path[0])
import tornado.ioloop
import tornado.httpserver
import tornado.options
import config
import application
from config import settings
from views.index import updatedata

if __name__ == '__main__':
	tornado.options.parse_command_line()
	app = application.Application()
	httpServer = tornado.httpserver.HTTPServer(app)
	httpServer.listen(config.options['port'],address=config.options['ip'])
	httpServer.start(1)		# 开启1条jing程
	tornado.ioloop.PeriodicCallback(lambda :updatedata(app.download), 1000).start()
	tornado.ioloop.IOLoop.current().start()